package net.entelijan.cobean.examples.lit;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import net.entelijan.cobean.examples.data.literature.wrapper.WsUtil;
import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.entelijan.cobean.util.LookAndFeel;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import edu.umd.cs.findbugs.annotations.SuppressWarnings;

public class Main {

	private static Log log = LogFactory.getLog(Main.class);

	public Main() {
		super();
	}

	@SuppressWarnings
	public static void main(String[] args) {
		try {
			LookAndFeel.PLASTIC_XP.use();
			WsUtil.loadProxyProperties();
			MainFrame frame = new MainFrame();
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			frame.setSize(800, 600);
			ExamplesUtil.centerFrame(frame);
			MainFrameController controller = new MainFrameController(
					new MainFrameModel(), frame, WsUtil.createWrappedService());
			controller.open();
		} catch (Exception e) {
			String msg = "Could not start because: " + e.getMessage();
			JOptionPane.showMessageDialog(null, msg);
			if (log.isDebugEnabled()) {
				log.error(msg, e);
			} else {
				log.error(msg);
			}
		}
	}

}
